\ Preprocessor standard macros - Copyright 2012 J.L. Bezemer
\ You can redistribute this file and/or modify it under
\ the terms of the GNU General Public License

:macro @swap <1< <2< >1> >2> ;         ( vars 1, 2 | n1 n2 -- n2 n1)
:macro @dup  <1< >1> >1> ;             ( vars 1 | n1 -- n1 n1)
:macro @over <1< <2< >2> >1> >2> ;     ( vars 1, 2 | n1 n2 -- n1 n2 n1)
:macro @rot <1< <2< <3< >2> >1> >3> ;  ( vars 1, 2, 3 | n1 n2 n3 -- n2 n3 n1)
                                       ( vars 1, 2 | n1 n2 -- n3)
:macro _max @minus @add @sign >>> -1 @while @drop @drop >2> @dup ;
:macro @max <2< @dup >2> _max @drop ;
                                       ( vars 1, 2 | n1 n2 -- n3)
:macro _min @minus @add @sign >>> -1 @until @drop @drop >2> @dup ;
:macro @min <2< @dup >2> _min @drop ;
                                       ( vars 1 | n1 -- n2)
:macro _abs >1> @sign >>> -1 @while >1> @minus <1< ;
:macro @abs <1< _abs @drop >1> ;
